var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/configComponent/formset/FormFieldSet.tsx
var FormFieldSet_exports = {};
__export(FormFieldSet_exports, {
  FormFieldSet: () => FormFieldSet,
  default: () => FormFieldSet_default
});
module.exports = __toCommonJS(FormFieldSet_exports);
var import_react = require("react");
var import_functionalComponent = require("../../functionalComponent");
var import_util = require("../../util");
var import_common = require("../common");
function FormFieldSet(props) {
  const {
    title,
    collapsible = true,
    formConf = {},
    style: formFieldStyle,
    className: formFieldClassName,
    collapse: defaultCollapse,
    formSetRef,
    panelProps,
    outRef
  } = props;
  const [collapsed, setCollapsed] = (0, import_react.useState)(
    defaultCollapse !== void 0 ? defaultCollapse : formConf.collapse !== void 0 ? formConf.collapse : false
  );
  const defaultTitle = import_util.iup.getPageLang()[formConf.langKey] ?? title ?? formConf.label;
  const Comp = (0, import_common.getComp)({
    xtype: formConf.xtype === "fieldset" || !formConf.xtype ? "Form" : formConf.xtype
  }).instance;
  return /* @__PURE__ */ React.createElement(
    import_functionalComponent.Panel,
    {
      className: import_util.iup.classNames("iup-form-set", formFieldClassName),
      title: defaultTitle,
      collapsible,
      open: !collapsed,
      onOpenChange: () => setCollapsed(!collapsed),
      style: formFieldStyle,
      ...panelProps
    },
    /* @__PURE__ */ React.createElement("div", { className: "content" }, props.children ? props.children : /* @__PURE__ */ React.createElement(Comp, { ...props, ref: outRef, config: formConf, formSetRef: formSetRef || outRef, titleProps: void 0 }))
  );
}
var FormFieldSetCom = (0, import_util.compHoc)(
  (0, import_common.LayConfWrap)(FormFieldSet),
  "FormFieldSet"
);
var FormFieldSet_default = FormFieldSetCom;
(0, import_util.registerComponent)({ FormFieldSet });
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  FormFieldSet
});
